package com.kobe.java8;

import java.util.*;

public class ListDemo {

    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < 150000000; i++) {
            list.add(i);
        }

        long start = System.currentTimeMillis();
        list.spliterator().forEachRemaining(item->{
            item++;
        });
        System.out.println("spliterator cost "+(System.currentTimeMillis()-start));

        long start2 = System.currentTimeMillis();
        list.forEach(item->{item++;});
        System.out.println("foreach cost "+(System.currentTimeMillis()-start2));


        long start3 = System.currentTimeMillis();
        list.parallelStream().spliterator().forEachRemaining(item->item++);
        System.out.println("for i "+(System.currentTimeMillis()-start3));

        Vector  vector = new Vector();
        Stack stack = new Stack();
    }

}
